<template>
  <div class="header-container">
    <a href="#" class="logo"
      ><img
        src="https://lf3-cdn-tos.bytescm.com/obj/static/xitu_juejin_web/e08da34488b114bd4c665ba2fa520a31.svg"
        alt=""
    /></a>
    <div class="nav">
      <ul class="main-nav">
        <li v-for="(item, i) in title" :key="i">
          <router-link :to="'/'"
            ><span>{{ item }}</span></router-link
          >
        </li>
        <nav class="spec-nav">
          <a href="">开放社区<Icon type="triangleDown" /></a>
        </nav>
        <nav v-for="item in nav" :key="item">
          <a href="">{{ item }}</a>
        </nav>
      </ul>
      <ul class="right-nav">
        <li class="search-add">
          <ul class="search-add-ul">
            <li class="search">
              <form action="">
                <input type="text" placeholder="探索稀土掘金" maxlength="32" />
                <div class="search-icon">
                  <Icon type="magnifier" />
                </div>
              </form>
            </li>
            <li class="creator">
              <div class="add-group">
                <button class="add-btn">创作者中心</button>
                <Icon class="more" type="triangleDown" />
              </div>
            </li>
          </ul>
        </li>
        <li class="vip-entry">
          <img
            class="vip-img"
            src="	https://lf3-cdn-tos.bytescm.com/obj/static/xitu_juejin_web/24127194d5b158d7eaf8f09a256c5d01.svg"
            alt=""
          />
          <div class="vip-words">会员</div>
        </li>

        <li class="ring">
          <a href="">
            <Icon type="ring" />
            <span class="count">3</span>
          </a>
        </li>
        <li class="avatar">
          <Avatar
            url="https://p9-passport.byteacctimg.com/img/mosaic-legacy/3795/3033762272~300x300.image"
            :size="36"
          />
        </li>
      </ul>
    </div>
  </div>
</template>

<script>
import Icon from "@/components/Icon";
import Avatar from "@/components/Avatar";
export default {
  components: {
    Icon,
    Avatar,
  },
  computed: {
    title() {
      return ["首页", "沸点", "课程", "直播", "资讯", "活动"];
    },
    nav() {
      return ["商城", "APP", "插件"];
    },
  },
};
</script>

<style scoped lang="less">
@import "~@/styles/common.less";
@import "~@/download/icon/iconfont.css";
.header-container {
  background: #fff;
  border-bottom: 1px solid #f1f1f1;
  color: #909090;
  height: 5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: auto;
  .logo {
    margin-right: 14px;
    margin-left: 24px;
    display: inline-block;
    height: 22px;
    width: auto;
    line-height: 5rem;
    img {
      display: block;
      width: 107px;
      height: 22px;
    }
  }
  .nav {
    max-width: 1440px;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    .main-nav {
      height: 100%;
      display: flex;
      align-items: center;
      justify-content: center;
      li {
        cursor: pointer;
        align-items: center;
        justify-content: center;
        height: 5rem;
        white-space: nowrap;
        a {
          display: inline-block;
          height: 5rem;
          margin: 0 10px;
          line-height: 5rem;
          &:hover {
            border-bottom: 2px solid @active;
            color: darken(@words, 20%);
          }
        }
      }
      nav {
        cursor: pointer;
        align-items: center;
        justify-content: center;
        height: 5rem;
        white-space: nowrap;
        a {
          display: inline-block;
          height: 5rem;
          margin: 0 14px;
          line-height: 5rem;
          &:hover {
            color: darken(@words, 20%);
          }
        }
        &.spec-nav {
          .icon-font {
            font-size: 12px;
          }
        }
        &:hover .icon-container {
          transform: rotate(-180deg);
          transform-origin: center;
          transition: all 1s;
        }
      }
    }
    .right-nav {
      display: flex;
      align-items: center;
      justify-content: flex-end;
      position: relative;
      height: 100%;
      margin: 0;
      order: 0;
      .search-add {
        flex: 1 1 auto;
        height: 5rem;
        display: flex;
        justify-content: flex-end;
        .search-add-ul {
          display: flex;
          justify-content: flex-start;
          .search {
            color: #86909c;
            padding: 0 1rem;
            font-size: 1.167rem;
            margin: 0;
            height: 100%;
            display: flex;
            justify-content: center;
            align-items: center;
            form {
              width: 360px;
              background-color: #fff;
              display: flex;
              align-items: center;
              justify-content: space-between;
              border-radius: 4px;
              position: relative;
              height: 39px;
              border: 1px solid #c2c8d1;
              transition: width 0.2s;
              input {
                border: none;
                width: calc(100% - 44px);
                padding: 9px 0 9px 14px;
                box-shadow: none;
                outline: none;
                font-size: 15.4px;
                color: #8a919f;
                background-color: transparent;
                transition: width 0.3s;
                &::placeholder {
                  color: #ccc;
                }
              }
              .search-icon {
                position: relative;
                left: -2px;
                width: 44px;
                height: 30px;
                background: #f2f3f5;
                border-radius: 2px;
                i.icon-container {
                  width: 100%;
                  height: 100%;
                  position: absolute;
                  text-align: center;
                  line-height: 30px;
                }
              }
            }
          }
          .creator {
            display: flex;
            overflow: visible;
            width: 154px;
            padding-left: 5px;
            justify-content: center;
            .add-group {
              display: flex;
              align-items: center;
              .add-btn {
                padding: 0 14px;
                font-size: 16px;
                border-radius: 3px;
                white-space: nowrap;
                height: 35px;
                color: #fff;
                background-color: @active;
                border-radius: 3px 0 0 3px;
                border: none;
                transition: background-color 0.1s linear 0.05s;
                cursor: pointer;
                &:hover {
                  background-color: darken(@active, 5%);
                }
              }
              .more {
                display: flex;
                background-color: @active;
                cursor: pointer;
                height: 35px;
                align-items: center;
                justify-content: center;
                color: #fff;
                border-radius: 0 3px 3px 0;
                font-size: 12px;
                &:hover {
                  background-color: darken(@active, 5%);
                }
              }
            }
          }
        }
      }
      .vip-entry {
        display: flex;
        padding: 0 14px;
        .vip-words {
          color: @lightWords;
          font-weight: 400;
          font-size: 14px;
          line-height: 5rem;
          margin-left: 4px;
          white-space: nowrap;
        }
      }
      .ring {
        display: flex;
        position: relative;
        padding-right: 14px;
        .icon-container {
          font-size: 25px;
        }
        .count {
          position: absolute;
          left: 15px;
          bottom: 65%;
          margin: 0;
          line-height: 11px;
          text-align: center;
          border-radius: 3rem;
          word-break: normal;
          display: inline-block;
          color: #f1f1f1;
          transform: scale(0.8);
          font-size: 1rem;
          font-weight: 500;
          padding: 3px 5px;
          background: #f03535;
          border-radius: 50px;
          border: 1px solid #fff;
        }
      }
      .avatar {
        padding: 0 14px;
      }
    }
  }
}
</style>